<template>
    <view class="main">
        <Nav title="老照片修复" :isBack="false" :showRight="false"></Nav>
        <view class="banner">
            <view class="head">
                <image
                    class="ban"
                    src="../../static/images/banner1.png"
                    mode=""
                />
                <view class="p"> 老照片修复/上色 </view>
                <view class="h6"> 一键智能把黑白照片变彩色、清晰 </view>
            </view>
        </view>
        <view class="function">
            <view
                v-for="(item, index) in list"
                :key="index"
                class="text container"
                @click="toGetImage(item)"
            >
                <view class="main">
                    <view class="bg">
                        <image :src="item.bg" />
                    </view>
                    <view class="icon">
                        <image :src="item.icon" mode="widthFix" />
                    </view>
                    <view class="title">{{ item.title }}</view>
                </view>
            </view>
        </view>
    </view>
</template>

<script>
import { getUpdateManger } from "../../tools/update";
import { mapMutations } from "vuex";
export default {
    data() {
        return {
            list: [
                {
                    bg: "/static/images/bg01.png",
                    icon: "/static/images/icon01.png",
                    title: "修复/上色",
                    type: 1,
                    needUrl: 0,
                },
                {
                    bg: "/static/images/bg02.png",
                    icon: "/static/images/icon02.png",
                    title: "清晰度增强",
                    type: 2,
                    needUrl: 0,
                },
                {
                    bg: "/static/images/bg03.png",
                    icon: "/static/images/icon03.png",
                    title: "无损放大",
                    type: 3,
                    needUrl: 0,
                },
                {
                    bg: "/static/images/bg04.png",
                    icon: "/static/images/icon04.png",
                    title: "漫画脸",
                    type: 4,
                    needUrl: 0,
                },
                /* {
                    bg: "/static/images/bg05.png",
                    icon: "/static/images/icon05.png",
                    title: "老照片修复",
                    type: 5,
                    needUrl: 0,
                }, */
                {
                    bg: "/static/images/bg06.png",
                    icon: "/static/images/icon06.png",
                    title: "性别转换",
                    type: 6,
                    needUrl: 1,
                },
                {
                    bg: "/static/images/bg07.png",
                    icon: "/static/images/icon07.png",
                    title: "变老特效",
                    type: 7,
                    needUrl: 1,
                },
            ],
        };
    },
    methods: {
        toGetImage({ type, needUrl }) {
            uni.navigateTo({
                url: `../cut/cut?type=${type}&needUrl=${needUrl}&url=`,
            });
        },
        ...mapMutations(["updateCount", "initCount"]),
    },
    onLoad() {
        this.initCount();
        // #ifdef APP-PLUS
        getUpdateManger();
        // #endif
    },
    onBackPress() {
        // #ifdef APP-PLUS
        uni.sendNativeEvent(
            "exitapp",
            { appId: plus.runtime.appid },
            ret => {}
        );
        plus.runtime.quit();
        // #endif
        return true;
    },
    onReady() {
        // #ifdef MP-QQ
        qq.showShareMenu({
            showShareItems: ["qq", "qzone", "wechatFriends", "wechatMoment"],
        });
        // #endif
    },
};
</script>
<style lang="scss" scoped>
view {
    box-sizing: border-box;
}
.banner {
    padding: 28rpx;
    width: 100%;
    // height: 510rpx;
    background-image: url("../../static/images/bg_index.png");
    background-size: 100% 100%;
    .head {
        padding: 30rpx 40rpx;
        background-color: #fff;
        border-radius: 10rpx;
        margin-bottom: 40rpx;
        width: 100%;
        text-align: center;
        .ban {
            width: 100%;
            height: 190rpx;
        }
        .p {
            color: #4657b9;
            font-size: 48rpx;
        }
        .h6 {
            color: #626262;
            font-size: 32rpx;
        }
    }
}
.function {
    padding: 0 28.8rpx 28.8rpx;
    display: flex;
    align-items: center;
    // justify-content: space-around;
    flex-wrap: wrap;
    width: 100%;
    align-items: center;
    .container {
        margin-top: 28.42rpx;
        width: 50%;
        display: flex;
        align-items: center;
        .main {
            position: relative;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            text-align: center;
            margin: 0 auto;
            width: 315rpx;
            height: 184rpx;
            background: #ffffff;
            box-shadow: 7rpx 13rpx 23rpx 0px rgba(204, 199, 224, 0.42);
            .bg {
                position: absolute;
                top: 0;
                left: 0;
                right: 0;
                bottom: 0;
                image {
                    width: 100%;
                    height: 100%;
                }
            }
            border-radius: 19rpx;
            .icon {
                position: absolute;
                right: 48rpx;
                bottom: 36rpx;
                image {
                    width: 72rpx;
                    height: 100rpx;
                }
            }
            .title {
                position: absolute;
                top: 32rpx;
                left: 24rpx;
                font-size: 28rpx;
                font-family: SourceHanSansCN-Regular, SourceHanSansCN;
                font-weight: 400;
                color: #ffffff;
                line-height: 42rpx;
            }
        }
    }
}
.container {
    // padding: 28rpx;
    .line {
        display: flex;
        padding: 30rpx 50rpx;
        background-color: #cfdef8;
        align-items: center;
        border-radius: 10rpx;
        margin-bottom: 40rpx;
        .left {
            flex: 1;
            color: #354762;
            font-size: 38rpx;
        }
        .icon {
            display: inline-block;
            width: 28rpx;
            height: 28rpx;
            border-top: 5rpx solid #f6f6f6;
            border-right: 5rpx solid #f6f6f6;
            transform: rotate(45deg);
        }
    }
}
</style>
